// Heuristic.h: interface for the CHeuristic class.
//
//////////////////////////////////////////////////////////////////////

#ifndef HEURISTIC_H
#define HEURISTIC_H

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "AStarSolver.h"

class CGraph;
struct GraphNode;

/// Just uses distance
class CStandardHeuristic : public CHeuristic
{
public:
  CStandardHeuristic();
	~CStandardHeuristic();

  /// Allow using a different position than the node position for start/end
  void SetStartEndData(const GraphNode *pStartNode, const Vec3 &startPos, const GraphNode *pEndNode, const Vec3 &endPos, const PathfindingExtraConstraints &extraConstraints);

  void ClearConstraints() { m_extraConstraints.resize(0); }

	virtual float EstimateCost(const AStarSearchNode & node0, const AStarSearchNode & node1) const;
  virtual float CalculateCost(const CGraph * graph,
		const AStarSearchNode & node0, unsigned linkIndex0,
		const AStarSearchNode & node1,
    const TNavigationBlockers& navigationBlockers) const;
  virtual const PathfindingHeuristicProperties* GetProperties() const {return &m_properties;}
  void SetProperties(const PathfindingHeuristicProperties &properties);

private:
	CStandardHeuristic(const CStandardHeuristic&);
	CStandardHeuristic& operator = (const CStandardHeuristic&);

private:
  /// returns either the node position, or the start/end position if it's a start/end node (from the requester)
  const Vec3 &GetNodePos(const GraphNode &node) const;

	PathfindingHeuristicProperties m_properties;
	PathfindingExtraConstraints m_extraConstraints;

  /// cache the minimum of all our extra cost factors
  float m_fMinExtraFactor;
	const GraphNode *m_pStartNode, *m_pEndNode;
  Vec3 m_startPos, m_endPos;
};


#endif
